import Vue from 'vue'
import DateTimeTip from '../components/DateTime.vue'
Vue.component('DateTimeTip', DateTimeTip)
export function allForm() {
  return [
    {
      label: '计划名称',
      prop: 'name',
    },
    {
      filterable: true,
      multiple: true,
      type: 'select',
      label: '参与人群',
      prop: 'crowd_rule_ids',
      dicData: this.userGroupList,
      rules: [
        {
          required: true,
          message: '请选择参与人群',
        },
      ],
    },
    {
      filterable: true,
      type: 'select',
      prop: 'film_id',
      label: '影片名称',
      dicData: this.movieList,
      props: { label: 'name', value: 'id' },
      control: async (val, form) => {
        this.movieChilist = await this.getMovieChil(val)
        return {
          film_episode_no: {
            dicData: this.movieChilist,
          },
        }
      },
    },
    {
      filterable: true,
      type: 'select',
      prop: 'film_episode_no',
      label: '集名称',
      dicData: this.movieChilist,
      props: { label: 'episode_no', value: 'episode_no' },
    },

    {
      label: '推送标题',
      prop: 'title',
      rules: [
        {
          required: true,
          message: '请输入推送标题',
        },
      ],
    },
    {
      type: 'textarea',
      label: '推送内容',
      prop: 'content',
    },
    {
      type: 'select',
      label: '跳转页面',
      prop: 'page',
      dicData: [
        { value: 0, label: '首页' },
        { value: 1, label: 'for you' },
        { value: 2, label: 'top up充值' },
        { value: 3, label: '福利中心' },
      ],
    },
    {
      type: 'datetime',
      label: '推送时间',
      prop: 'push_time',
      blur: ({ value, column }) => {
        if (value) {
          this.dialogForm.dateTip.push(value)
        }
      },
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() < Date.now()
        },
      },
    },
    {
      prop: 'dateTip',
      disabled: true,
      component: DateTimeTip,
    },
    {
      label: '推送封面图',
      prop: 'img_url',
      component: 'UploadImage',
      params: {
        maxSize: 5120,
        multiple: false,

        params: {
          dir: 'push_img',
          ty: 'oss',
        },
      },
    },
    {
      label: '计划状态',
      type: 'select',
      prop: 'status',
      dicData: [
        { value: 1, label: '开启' },
        { value: 2, label: '禁用' },
        { value: 3, label: '已推送' },
      ],
    },
    {
      type: 'textarea',
      label: '测试粉丝ID',
      prop: 'user_ids',
    },
  ]
}
